#include <stdio.h>
#include <stdlib.h>

struct node {
	int data;
	struct node *next;
};

void push(struct node **, int);

void main(void) {
	struct node *head = NULL;
	int i;

	struct node ** head_ref = &head;
	struct node *test;
	for (i = 1; i < 10; i ++) {
		push(head_ref, i);
		if (i == 1) {
			test = head;
		}
		head_ref = &((*head_ref)->next);
	}


	for (i = 1; i < 10; i ++) {
		printf("%d ", test->data);
		test = test->next;
	}
	printf("\n");
}

void push(struct node **ref, int data) {
	struct node *new_node = malloc(sizeof(struct node));

	new_node->data = data;
	*ref = new_node;
}
